package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;
import android.graphics.Typeface;
import android.view.View;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemServiceCategoryLeftBinding;
import com.sgb.kjwl.model.entity.ParentAreaEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class ServiceCategoryLeftAdpater extends BaseRecycleAdapter<ParentAreaEntity<List<ParentAreaEntity<List<ParentAreaEntity>>>>> {
    private int poinsion = -1;

    public ServiceCategoryLeftAdpater(Context context, List<ParentAreaEntity<List<ParentAreaEntity<List<ParentAreaEntity>>>>> datas) {
        super(context, R.layout.item_service_category_left, datas);
    }


    @Override
    public void convert(ItemViewHolder holder, ParentAreaEntity<List<ParentAreaEntity<List<ParentAreaEntity>>>> listParentAreaEntity) {
        holder.setBinding(BR.viewmodel, listParentAreaEntity);
        boolean selected = holder.itemView.isSelected();
        ((ItemServiceCategoryLeftBinding) holder.getmBinding()).categoryMark.setVisibility(selected ? View.VISIBLE : View.INVISIBLE);
        if (selected) {
            ((ItemServiceCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.BOLD);
        } else {
            ((ItemServiceCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.NORMAL);
        }
    }
}
